<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>薪资预测系统</title>
    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        :root {
            --primary-gradient: linear-gradient(135deg, #165DFF 0%, #4080FF 100%);
            --secondary-gradient: linear-gradient(135deg, #F0F5FF 0%, #E0E8FF 100%);
            --accent-color: #FF7D00;
            --text-dark: #1D2129;
            --text-light: #4E5969;
            --bg-card: #FFFFFF;
            --border-color: #E5E6EB;
            --border-radius: 18px;
            --box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
            --box-shadow-hover: 0 15px 35px rgba(0, 0, 0, 0.12);
            --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            --button-hover-gradient: linear-gradient(135deg, #0E42D2 0%, #356EFF 100%);
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Inter', sans-serif;
            line-height: 1.6;
            color: var(--text-dark);
            background: var(--secondary-gradient);
            padding: 40px;
            min-height: 100vh;
            display: flex;
            justify-content: center;
            align-items: flex-start;
        }

        .container {
            max-width: 900px;
            width: 100%;
            background: var(--bg-card);
            border-radius: var(--border-radius);
            box-shadow: var(--box-shadow);
            overflow: hidden;
            transition: var(--transition);
            transform: translateY(0);
            animation: fadeInUp 0.8s ease-out;
        }

        .container:hover {
            transform: translateY(-8px);
            box-shadow: var(--box-shadow-hover);
        }

        .header {
            background: var(--primary-gradient);
            color: white;
            padding: 60px 30px;
            text-align: center;
            position: relative;
            overflow: hidden;
            clip-path: polygon(0 0, 100% 0, 100% 90%, 0 100%);
        }

        .header::after {
            content: "";
            position: absolute;
            bottom: -20px;
            left: 0;
            width: 100%;
            height: 40px;
            background: var(--bg-card);
            clip-path: polygon(0 100%, 100% 100%, 100% 0, 0 0);
        }

        .header-pattern {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            opacity: 0.05;
            background-image:
                radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.3) 0%, transparent 20%),
                radial-gradient(circle at 70% 60%, rgba(255, 255, 255, 0.2) 0%, transparent 15%);
        }

        h1 {
            font-weight: 700;
            font-size: 3.2rem;
            margin-bottom: 15px;
            position: relative;
            z-index: 1;
            text-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
        }

        .header-subtitle {
            font-size: 1.3rem;
            font-weight: 400;
            opacity: 0.9;
            max-width: 700px;
            margin: 0 auto;
            position: relative;
            z-index: 1;
        }

        .form-container {
            padding: 50px;
        }

        .form-group {
            margin-bottom: 35px;
            transition: var(--transition);
        }

        .form-group:hover .form-input {
            transform: translateY(-3px);
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.06);
        }

        .form-label {
            display: flex;
            align-items: center;
            margin-bottom: 15px;
            font-weight: 500;
            color: var(--text-dark);
            font-size: 1.1rem;
        }

        .form-label i {
            width: 28px;
            height: 28px;
            margin-right: 12px;
            color: #6B7280;
            transition: var(--transition);
        }

        .form-input-wrapper {
            position: relative;
        }

        .form-input {
            width: 100%;
            padding: 18px 22px;
            padding-left: 60px;
            border: 1px solid var(--border-color);
            border-radius: var(--border-radius);
            font-size: 1.1rem;
            transition: var(--transition);
            background: var(--bg-card);
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
            color: var(--text-dark);
        }

        .form-input:focus {
            outline: none;
            border-color: #165DFF;
            box-shadow: 0 0 0 4px rgba(22, 93, 255, 0.2);
            transform: translateY(0);
        }

        .form-input-icon {
            position: absolute;
            left: 22px;
            top: 50%;
            transform: translateY(-50%);
            color: #9CA3AF;
            transition: var(--transition);
        }

        .form-input:focus + .form-input-icon {
            color: #165DFF;
        }

        button {
            background: var(--primary-gradient);
            color: white;
            border: none;
            padding: 18px 26px;
            font-size: 1.1rem;
            border-radius: var(--border-radius);
            cursor: pointer;
            width: 100%;
            font-weight: 600;
            transition: var(--transition);
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 12px;
            box-shadow: 0 6px 18px rgba(22, 93, 255, 0.3);
        }

        button:hover {
            background: var(--button-hover-gradient);
            transform: translateY(-4px);
            box-shadow: 0 10px 25px rgba(22, 93, 255, 0.4);
        }

        button i {
            transition: var(--transition);
        }

        button:hover i {
            transform: translateX(6px);
        }

        .result {
            text-align: center;
            padding: 40px;
            margin-top: 40px;
            background: rgba(255, 255, 255, 0.8);
            border-radius: var(--border-radius);
            backdrop-filter: blur(12px);
            -webkit-backdrop-filter: blur(12px);
            border: 1px solid rgba(255, 255, 255, 0.3);
            box-shadow: 0 6px 20px rgba(0, 0, 0, 0.05);
            display: none;
            animation: fadeIn 0.5s ease-out forwards;
            opacity: 0;
            transform: translateY(20px);
        }

        .result.show {
            display: block;
        }

        @keyframes fadeIn {
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        @keyframes fadeInUp {
            from {
                opacity: 0;
                transform: translateY(20px);
            }

            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        h2 {
            color: var(--text-dark);
            font-size: 2rem;
            margin-bottom: 20px;
            font-weight: 600;
        }

        .prediction-value {
            font-size: 3.5rem;
            font-weight: 700;
            color: var(--accent-color);
            margin: 20px 0;
            display: block;
            text-shadow: 0 3px 6px rgba(0, 0, 0, 0.05);
        }

        .result-note {
            color: var(--text-light);
            font-size: 1.05rem;
            max-width: 600px;
            margin: 0 auto;
        }

        .plot-container {
            margin-top: 40px;
            text-align: center;
            animation: fadeIn 0.8s ease-out;
        }

        .plot-container img {
            max-width: 100%;
            height: auto;
            border-radius: var(--border-radius);
            box-shadow: var(--box-shadow);
            transition: var(--transition);
        }

        .plot-container img:hover {
            transform: scale(1.03);
            box-shadow: var(--box-shadow-hover);
        }

        @media (max-width: 768px) {
            body {
                padding: 20px;
            }

            .container {
                margin: 15px;
                padding: 0;
            }

            .header {
                padding: 40px 20px;
            }

            h1 {
                font-size: 2.5rem;
            }

            .header-subtitle {
                font-size: 1.1rem;
            }

            .form-container {
                padding: 30px;
            }

            .form-group {
                margin-bottom: 25px;
            }

            .form-input {
                padding: 16px 20px;
                padding-left: 55px;
            }

            .form-label {
                font-size: 1rem;
            }

            .prediction-value {
                font-size: 2.8rem;
            }
        }

        @media (max-width: 480px) {
            h1 {
                font-size: 2rem;
            }

            .header-subtitle {
                font-size: 1rem;
            }

            .form-input {
                padding: 14px 16px;
                padding-left: 50px;
            }

            .form-label {
                font-size: 0.95rem;
            }

            .prediction-value {
                font-size: 2.2rem;
            }
        }
    </style>
</head>

<body>
    <div class="container">
        <div class="header">
            <div class="header-pattern"></div>
            <h1>薪资预测系统</h1>
            <p class="header-subtitle">基于大数据分析的智能薪资评估平台，精准预测您的市场价值</p>
        </div>

        <div class="form-container">
            <form action="" method="post">
                <div class="form-group">
                    <label for="experience" class="form-label">
                        <i class="fas fa-clock"></i>
                        工作经验（年）
                    </label>
                    <div class="form-input-wrapper">
                        <i class="fas fa-clock form-input-icon"></i>
                        <input type="number" id="experience" name="experience" required min="0" max="50"
                            placeholder="请输入工作经验年限" class="form-input">
                    </div>
                </div>

                <div class="form-group">
                    <label for="education" class="form-label">
                        <i class="fas fa-graduation-cap"></i>
                        学历
                    </label>
                    <div class="form-input-wrapper">
                        <i class="fas fa-graduation-cap form-input-icon"></i>
                        <select id="education" name="education" required class="form-input">
                            <option value="" disabled selected>请选择您的学历</option>
                            <option value="本科">本科</option>
                            <option value="硕士">硕士</option>
                            <option value="大专">大专</option>
                            <option value="不限">不限</option>
                        </select>
                    </div>
                </div>

                <div class="form-group">
                    <label for="location" class="form-label">
                        <i class="fas fa-map-marker-alt"></i>
                        区域
                    </label>
                    <div class="form-input-wrapper">
                        <i class="fas fa-map-marker-alt form-input-icon"></i>
                        <select id="location" name="location" required class="form-input">
                            <option value="" disabled selected>请选择所在区域</option>
                            <option value="嘉定区">嘉定区</option>
                            <option value="宝山区">宝山区</option>
                            <option value="徐汇区">徐汇区</option>
                            <option value="普陀区">普陀区</option>
                            <option value="杨浦区">杨浦区</option>
                            <option value="松江区">松江区</option>
                            <option value="浦东新区">浦东新区</option>
                            <option value="虹口区">虹口区</option>
                            <option value="长宁区">长宁区</option>
                            <option value="闵行区">闵行区</option>
                            <option value="闸北区">闸北区</option>
                            <option value="青浦区">青浦区</option>
                            <option value="静安区">静安区</option>
                            <option value="黄浦区">黄浦区</option>
                        </select>
                    </div>
                </div>

                <button type="submit">
                    <i class="fas fa-calculator"></i>
                    预测薪资
                </button>
            </form>

            {% if prediction %}
            <div class="result show">
                <h2>预测结果</h2>
                <div class="prediction-value">{{ prediction }} 元</div>
                <p class="result-note">基于您的工作经验、学历背景和所在区域的市场薪资数据综合计算得出</p>
            </div>
            {% endif %}

            {% if plot_url_avg_salary %}
            <div class="plot-container">
                <h2>地区和平均薪资的关系</h2>
                <img src="data:image/png;base64,{{ plot_url_avg_salary }}" alt="地区和平均薪资的关系">
            </div>
            {% endif %}

            {% if plot_url_education_salary %}
            <div class="plot-container">
                <h2>学历和薪资的箱线图</h2>
                <img src="data:image/png;base64,{{ plot_url_education_salary }}" alt="学历和薪资的箱线图">
            </div>
            {% endif %}

            {% if error_message %}
            <div class="result show" style="color: red;">
                <h2>错误信息</h2>
                <p>{{ error_message }}</p>
            </div>
            {% endif %}
        </div>
    </div>
</body>

</html>